<?php

!defined('IN_VIFRAME') && die('Access Denied.');

abstract class TLib {
	
	protected static
		$_LastParam = array();
	
	protected static function _filterParam($key, $param, $default = 0) {
		if (!isset(self::$_LastParam[$key])) {
			self::$_LastParam[$key] = false;
		}
		
		$lastParam = & self::$_LastParam[$key];
		
		if (false === $param){
			if (false === $lastParam) {
				$param = $lastParam = $default;
			} else {
				$param = $lastParam;
			}
		} else {
			$lastParam = $param;
		}
		
		return $param;
	}
	
	protected static function _filterConfigParam($config, $default) {
		return $config + $default;
	}
}